"use strict";
cc._RF.push(module, '6b03aYkWwZJUI69YmGqYMSZ', 'SoundManager');
// scripts/SoundManager.js

"use strict";

var t = require;
var e = module;
var o = exports;

var _i,
    n = void 0 && (void 0).__extends || (_i = function i(t, e) {
  return (_i = Object.setPrototypeOf || {
    __proto__: []
  } instanceof Array && function (t, e) {
    t.__proto__ = e;
  } || function (t, e) {
    for (var o in e) {
      Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
    }
  })(t, e);
}, function (t, e) {
  function o() {
    this.constructor = t;
  }

  _i(t, e), t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o());
}),
    a = void 0 && (void 0).__decorate || function (t, e, o, i) {
  var n,
      a = arguments.length,
      r = a < 3 ? e : null === i ? i = Object.getOwnPropertyDescriptor(e, o) : i;
  if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, i);else for (var s = t.length - 1; s >= 0; s--) {
    (n = t[s]) && (r = (a < 3 ? n(r) : a > 3 ? n(e, o, r) : n(e, o)) || r);
  }
  return a > 3 && r && Object.defineProperty(e, o, r), r;
};

Object.defineProperty(o, "__esModule", {
  value: !0
});
var r = t("GlobalUserData"),
    s = t("Util"),
    l = cc._decorator,
    c = l.ccclass,
    d = (l.property, function (t) {
  function e() {
    var e = null !== t && t.apply(this, arguments) || this;
    return e.ios_bgm = null, e.current_audio_bgm = null, e.wx_bgm = null, e;
  }

  var o;
  return n(e, t), o = e, e.GetInstance = function () {
    return null == this._instance && (this._instance = new o()), this._instance;
  }, e.prototype.playMusic = function (t) {
    this.current_audio_bgm = t, r["default"].isOffMusic || (s.Util.is_wx() && "ios" == s.Util.getSystemInfo().platform ? (this.ios_bgm && cc.audioEngine.stop(this.ios_bgm), this.ios_bgm = cc.audioEngine.play(t, !0, 1)) : (cc.audioEngine.stopMusic(), cc.audioEngine.playMusic(t, !0)));
  }, e.prototype.playBgMusic = function (t) {
    r["default"].isOffMusic || (s.Util.is_wx() && "ios" == s.Util.getSystemInfo().platform ? this.ios_bgm = cc.audioEngine.play(t, !0, 1) : cc.audioEngine.playMusic(t, !0));
  }, e.prototype.play_current_bgm = function () {
    var t = this;
    r["default"].isOffMusic || (s.Util.is_wx() && "ios" == s.Util.getSystemInfo().platform ? (setTimeout(function () {
      cc.audioEngine.stopAll();
    }, 500), setTimeout(function () {
      cc.audioEngine.play(t.current_audio_bgm, !0, 1), cc.log("恢复音频");
    }, 1e3)) : (cc.audioEngine.stopMusic(), cc.audioEngine.playMusic(this.current_audio_bgm, !0)));
  }, e.prototype.stopMusic = function () {
    s.Util.is_wx() ? "ios" == s.Util.getSystemInfo().platform ? (cc.audioEngine.stopAll(), this.ios_bgm = null) : setTimeout(function () {
      cc.audioEngine.stopMusic();
    }, 100) : cc.audioEngine.stopMusic();
  }, e.prototype.playSound = function (t, e) {
    if (void 0 === e && (e = 1), !r["default"].isOffMusic) try {
      return cc.audioEngine.play(t, !1, e);
    } catch (o) {}
  }, e.prototype.playSoundLoop = function (t) {
    if (!r["default"].isOffMusic) return cc.audioEngine.play(t, !0, 1);
  }, e.prototype.stopSoundLoop = function (t) {
    r["default"].isOffMusic || cc.audioEngine.play(t, !0, 1);
  }, e.prototype.stopAll = function () {
    cc.audioEngine.stopAll();
  }, e.prototype.stopAudioByID = function (t) {
    cc.audioEngine.stop(t);
  }, e._instance = null, o = a([c], e);
}(cc.Component));
o["default"] = d;

cc._RF.pop();